#include "SMPPEncoder.hpp"

using namespace smpp::encoder;

Encoder::Encoder() {}

Encoder::Encoder(const Encoder &nEncoder):
	_Massive(nEncoder._Massive) {}

void Encoder::setMassive(const QByteArray &nMassive){
	_Massive = nMassive;
}

const QByteArray Encoder::getMassive() const{
	return _Massive;
}

void Encoder::clearMassive(){
	_Massive.clear();
}

void Encoder::_quint8(const quint8 nQuint8) {
	_Massive.push_back(nQuint8);
}

void Encoder::_quint16(const quint16 nQquint16) {
	for (int i=0;i<2;i++)
		_Massive.push_back(((quint8*)&nQquint16)[1-i]);
}

void Encoder::_quint32(const quint32 nUint32) {
	for (int i=0;i<4;i++)
		_Massive.push_back(((quint8*)&nUint32)[3-i]);
}

void Encoder::_octetString(const octetString &nOctetString) {
	_Massive += QByteArray(nOctetString.data(),nOctetString.size());
}

void Encoder::_CoctetString(const CoctetString &nCoctetString) {
	_Massive += nCoctetString;
	_Massive.push_back('\0');
}

void Encoder::_Header(const Header &nHeader){
	_quint32(nHeader.getCommandLength());
	_quint32(nHeader.getCommandId());
	_quint32(nHeader.getCommandStatus());
	_quint32(nHeader.getSequenceNumber());
}

void Encoder::_TLVbase(const TLV &nTLV){
	_quint16(nTLV.getTag());
	_quint16(nTLV.getLength());
}

void Encoder::_AdditionalStatusInfoText(
	const AdditionalStatusInfoText &nAdditionalStatusInfoText){
	_TLVbase(nAdditionalStatusInfoText);
	_CoctetString(nAdditionalStatusInfoText.getValue());
}

void Encoder::_AlertOnMessageDelivery(
	const AlertOnMessageDelivery &nAlertOnMessageDelivery){
	_TLVbase(nAlertOnMessageDelivery);
	_octetString(nAlertOnMessageDelivery.getValue());
}

void Encoder::_BillingIdentification(
	const BillingIdentification &nBillingIdentification){
	_TLVbase(nBillingIdentification);
	_octetString(nBillingIdentification.getValue());
}

void Encoder::_BroadcastAreaIdentifier(
	const BroadcastAreaIdentifier &nBroadcastAreaIdentifier){
	_TLVbase(nBroadcastAreaIdentifier);
	_octetString(nBroadcastAreaIdentifier.getValue());
}

void Encoder::_BroadcastAreaSuccess(
	const BroadcastAreaSuccess &nBroadcastAreaSuccess){
	_TLVbase(nBroadcastAreaSuccess);
	_quint8(nBroadcastAreaSuccess.getValue());
}

void Encoder::_BroadcastChannelIndicator(
	const BroadcastChannelIndicator &nBroadcastChannelIndicator){
	_TLVbase(nBroadcastChannelIndicator);
	_quint8(nBroadcastChannelIndicator.getValue());
}

void Encoder::_BroadcastContentType(
	const BroadcastContentType &nBroadcastContentType){
	_TLVbase(nBroadcastContentType);
	_octetString(nBroadcastContentType.getValue());
}

void Encoder::_BroadcastContentTypeInfo(
	const BroadcastContentTypeInfo &nBroadcastContentTypeInfo){
	_TLVbase(nBroadcastContentTypeInfo);
	_octetString(nBroadcastContentTypeInfo.getValue());
}

void Encoder::_BroadcastEndTime(
	const BroadcastEndTime &nBroadcastEndTime){
	_TLVbase(nBroadcastEndTime);
	_CoctetString(nBroadcastEndTime.getValue());
}

void Encoder::_BroadcastErrorStatus(
	const BroadcastErrorStatus &nBroadcastErrorStatus){
	_TLVbase(nBroadcastErrorStatus);
	_quint32(nBroadcastErrorStatus.getValue());
}	

void Encoder::_BroadcastFrequencyInterval(
	const BroadcastFrequencyInterval &nBroadcastFrequencyInterval){
	_TLVbase(nBroadcastFrequencyInterval);
	_octetString(nBroadcastFrequencyInterval.getValue());
}

void Encoder::_BroadcastMessageClass(
	const BroadcastMessageClass &nBroadcastMessageClass){
	_TLVbase(nBroadcastMessageClass);
	_quint8(nBroadcastMessageClass.getValue());
}

void Encoder::_BroadcastRepNum(
	const BroadcastRepNum &nBroadcastRepNum){
	_TLVbase(nBroadcastRepNum);
	_quint16(nBroadcastRepNum.getValue());
}

void Encoder::_BroadcastServiceGroup(
	const BroadcastServiceGroup &nBroadcastServiceGroup){
	_TLVbase(nBroadcastServiceGroup);
	_octetString(nBroadcastServiceGroup.getValue());
}

void Encoder::_CallbackNum(
	const CallbackNum &nCallbackNum){
	_TLVbase(nCallbackNum);
	_octetString(nCallbackNum.getValue());
}

void Encoder::_CallbackNumAtag(
	const CallbackNumAtag &nCallbackNumAtag){
	_TLVbase(nCallbackNumAtag);
	_octetString(nCallbackNumAtag.getValue());
}

void Encoder::_CallbackNumPresInd(
	const CallbackNumPresInd &nCallbackNumPresInd){
	_TLVbase(nCallbackNumPresInd);
	_quint8(nCallbackNumPresInd.getValue());
}

void Encoder::_CongestionState(
	const CongestionState &nCongestionState){
	_TLVbase(nCongestionState);
	_quint8(nCongestionState.getValue());
}

void Encoder::_DeliveryFailureReason(
	const DeliveryFailureReason &nDeliveryFailureReason){
	_TLVbase(nDeliveryFailureReason);
	_quint8(nDeliveryFailureReason.getValue());
}

void Encoder::_DestAddrNpCountry(
	const DestAddrNpCountry &nDestAddrNpCountry){
	_TLVbase(nDestAddrNpCountry);
	_octetString(nDestAddrNpCountry.getValue());
}

void Encoder::_DestAddrNpInformation(
	const DestAddrNpInformation &nDestAddrNpInformation){
	_TLVbase(nDestAddrNpInformation);
	_octetString(nDestAddrNpInformation.getValue());
}

void Encoder::_DestAddrNpResolution(
	const DestAddrNpResolution &nDestAddrNpResolution){
	_TLVbase(nDestAddrNpResolution);
	_quint8(nDestAddrNpResolution.getValue());
}

void Encoder::_DestAddrSubunit(
	const DestAddrSubunit &nDestAddrSubunit){
	_TLVbase(nDestAddrSubunit);
	_quint8(nDestAddrSubunit.getValue());
}

void Encoder::_DestBearerType(
	const DestBearerType &nDestBearerType){
	_TLVbase(nDestBearerType);
	_quint8(nDestBearerType.getValue());
}

void Encoder::_DestNetworkId(
	const DestNetworkId &nDestNetworkId){
	_TLVbase(nDestNetworkId);
	_CoctetString(nDestNetworkId.getValue());
}

void Encoder::_DestNetworkType(
	const DestNetworkType &nDestNetworkType){
	_TLVbase(nDestNetworkType);
	_quint8(nDestNetworkType.getValue());
}

void Encoder::_DestNodeId(
	const DestNodeId &nDestNodeId){
	_TLVbase(nDestNodeId);
	_octetString(nDestNodeId.getValue());
}

void Encoder::_DestPort(
	const DestPort &nDestPort){
	_TLVbase(nDestPort);
	_quint16(nDestPort.getValue());
}

void Encoder::_DestSubaddress(
	const DestSubaddress &nDestSubaddress){
	_TLVbase(nDestSubaddress);
	_octetString(nDestSubaddress.getValue());
}

void Encoder::_DestTelematicsId(
	const DestTelematicsId &nDestTelematicsId){
	_TLVbase(nDestTelematicsId);
	_quint16(nDestTelematicsId.getValue());
}

void Encoder::_DisplayTime(
	const DisplayTime &nDisplayTime){
	_TLVbase(nDisplayTime);
	_quint8(nDisplayTime.getValue());
}

void Encoder::_DpfResult(
	const DpfResult &nDpfResult){
	_TLVbase(nDpfResult);
	_quint8(nDpfResult.getValue());
}

void Encoder::_ItsReplyType(
	const ItsReplyType &nItsReplyType){
	_TLVbase(nItsReplyType);
	_quint8(nItsReplyType.getValue());
}

void Encoder::_ItsSessionInfo(
	const ItsSessionInfo &n_ItsSessionInfo){
	_TLVbase(n_ItsSessionInfo);
	_quint16(n_ItsSessionInfo.getValue());
}

void Encoder::_LanguageIndicator(
	const LanguageIndicator &nLanguageIndicator){
	_TLVbase(nLanguageIndicator);
	_quint8(nLanguageIndicator.getValue());
}

void Encoder::_MessagePayload(
	const MessagePayload &nMessagePayload){
	_TLVbase(nMessagePayload);
	_octetString(nMessagePayload.getValue());
}

void Encoder::_MessageState(
	const MessageState &nMessageState){
	_TLVbase(nMessageState);
	_quint8(nMessageState.getValue());
}

void Encoder::_MoreMessagesToSend(
	const MoreMessagesToSend &nMoreMessagesToSend){
	_TLVbase(nMoreMessagesToSend);
	_quint8(nMoreMessagesToSend.getValue());
}

void Encoder::_MsAvailabilityStatus(
	const MsAvailabilityStatus &nMsAvailabilityStatus){
	_TLVbase(nMsAvailabilityStatus);
	_quint8(nMsAvailabilityStatus.getValue());
}

void Encoder::_MsMsgWaitFacilities(
	const MsMsgWaitFacilities &nMsMsgWaitFacilities){
	_TLVbase(nMsMsgWaitFacilities);
	_quint8(nMsMsgWaitFacilities.getValue());
}

void Encoder::_MsValidity(
	const MsValidity &nMsValidity){
	_TLVbase(nMsValidity);
	_octetString(nMsValidity.getValue());
}

void Encoder::_NetworkErrorCode(
	const NetworkErrorCode &nNetworkErrorCode){
	_TLVbase(nNetworkErrorCode);
	_octetString(nNetworkErrorCode.getValue());
}

void Encoder::_NumberOfMessages(
	const NumberOfMessages &nNumberOfMessages){
	_TLVbase(nNumberOfMessages);
	_quint8(nNumberOfMessages.getValue());
}

void Encoder::_PayloadType(
	const PayloadType &nPayloadType){
	_TLVbase(nPayloadType);
	_quint8(nPayloadType.getValue());
}

void Encoder::_PrivacyIndicator(
	const PrivacyIndicator &nPrivacyIndicator){
	_TLVbase(nPrivacyIndicator);
	_quint8(nPrivacyIndicator.getValue());
}

void Encoder::_QosTimeToLive(
	const QosTimeToLive &nQosTimeToLive){
	_TLVbase(nQosTimeToLive);
	_quint32(nQosTimeToLive.getValue());
}

void Encoder::_ReceiptedMessageId(
	const ReceiptedMessageId &nReceiptedMessageId){
	_TLVbase(nReceiptedMessageId);
	_CoctetString(nReceiptedMessageId.getValue());
}

void Encoder::_SarMsgRefNum(
	const SarMsgRefNum &nSarMsgRefNum){
	_TLVbase(nSarMsgRefNum);
	_quint16(nSarMsgRefNum.getValue());
}

void Encoder::_SarSegmentSeqnum(
	const SarSegmentSeqnum &nSarSegmentSeqnum){
	_TLVbase(nSarSegmentSeqnum);
	_quint8(nSarSegmentSeqnum.getValue());
}

void Encoder::_SarTotalSegments(
	const SarTotalSegments &nSarTotalSegments){
	_TLVbase(nSarTotalSegments);
	_quint8(nSarTotalSegments.getValue());
}

void Encoder::_SrInterfaceVersion(
	const SrInterfaceVersion &nSrInterfaceVersion){
	_TLVbase(nSrInterfaceVersion);
	_quint8(nSrInterfaceVersion.getValue());
}

void Encoder::_SetDpf(
	const SetDpf &nSetDpf){
	_TLVbase(nSetDpf);
	_quint8(nSetDpf.getValue());
}

void Encoder::_SmsSignal(
	const SmsSignal &nSmsSignal){
	_TLVbase(nSmsSignal);
	_quint16(nSmsSignal.getValue());
}

void Encoder::_SourceAddrSubunit(
	const SourceAddrSubunit &nSourceAddrSubunit){
	_TLVbase(nSourceAddrSubunit);
	_quint8(nSourceAddrSubunit.getValue());
}

void Encoder::_SourceBearerType(
	const SourceBearerType &nSourceBearerType){
	_TLVbase(nSourceBearerType);
	_quint8(nSourceBearerType.getValue());
}

void Encoder::_SourceNetworkId(
	const SourceNetworkId &nSourceNetworkId){
	_TLVbase(nSourceNetworkId);
	_CoctetString(nSourceNetworkId.getValue());
}

void Encoder::_SourceNetworkType(
	const SourceNetworkType &nSourceNetworkType){
	_TLVbase(nSourceNetworkType);
	_quint8(nSourceNetworkType.getValue());
}

void Encoder::_SourceNodeId(
	const SourceNodeId &nSourceNodeId){
	_TLVbase(nSourceNodeId);
	_octetString(nSourceNodeId.getValue());
}

void Encoder::_SourcePort(
	const SourcePort &nSourcePort){
	_TLVbase(nSourcePort);
	_quint16(nSourcePort.getValue());
}

void Encoder::_SourceSubaddress(
	const SourceSubaddress &nSourceSubaddress){
	_TLVbase(nSourceSubaddress);
	_octetString(nSourceSubaddress.getValue());
}

void Encoder::_SourceTelematicsId(
	const SourceTelematicsId &nSourceTelematicsId){
	_TLVbase(nSourceTelematicsId);
	_quint8(nSourceTelematicsId.getValue());
}

void Encoder::_UserMessageReference(
	const UserMessageReference &nUserMessageReference){
	_TLVbase(nUserMessageReference);
	_quint16(nUserMessageReference.getValue());
}

void Encoder::_UserResponseCode(
	const UserResponseCode &nUserResponseCode){
	_TLVbase(nUserResponseCode);
	_quint8(nUserResponseCode.getValue());
}

void Encoder::_UssdServiceOp(
	const UssdServiceOp &nUssdServiceOp){
	_TLVbase(nUssdServiceOp);
	_quint8(nUssdServiceOp.getValue());
}

void Encoder::_CancelBroadcastOptionalTLVs(
	const CancelBroadcastOptionalTLVs &nCancelBroadcastOptionalTLVs){
	if(nCancelBroadcastOptionalTLVs.getBroadcastContentType())
		_BroadcastContentType(
		*nCancelBroadcastOptionalTLVs.getBroadcastContentType());
	if(nCancelBroadcastOptionalTLVs.getUserMessageReference())
		_UserMessageReference(
		*nCancelBroadcastOptionalTLVs.getUserMessageReference());
}

void Encoder::_QueryBroadcastRequestOptionalTLVs(
	const QueryBroadcastRequestOptionalTLVs &
	nQueryBroadcastRequestOptionalTLVs){
	if(nQueryBroadcastRequestOptionalTLVs.getUserMessageReference())
		_UserMessageReference(
		*nQueryBroadcastRequestOptionalTLVs.getUserMessageReference());
}

void Encoder::_QueryBroadcastResponseOptionalTLVs(
	const QueryBroadcastResponseOptionalTLVs &
	nQueryBroadcastResponseOptionalTLVs){
	if(nQueryBroadcastResponseOptionalTLVs.getBroadcastEndTime())
		_BroadcastEndTime(
		*nQueryBroadcastResponseOptionalTLVs.getBroadcastEndTime());
	if(nQueryBroadcastResponseOptionalTLVs.getUserMessageReference())
		_UserMessageReference(
		*nQueryBroadcastResponseOptionalTLVs.getUserMessageReference());
}

void Encoder::_MessageReplacementTLVs(
	const MessageReplacementTLVs &nMessageReplacementTLVs){
	if(nMessageReplacementTLVs.getMessagePayload())
		_MessagePayload(*nMessageReplacementTLVs.getMessagePayload());
}

void Encoder::_BroadcastRequestOptionalTLVs(
	const BroadcastRequestOptionalTLVs &nBroadcastRequestOptionalTLVs){
	if(nBroadcastRequestOptionalTLVs.getAlertOnMessageDelivery())
		_AlertOnMessageDelivery(
		*nBroadcastRequestOptionalTLVs.getAlertOnMessageDelivery());
	if(nBroadcastRequestOptionalTLVs.getBroadcastChannelIndicator())
		_BroadcastChannelIndicator(
		*nBroadcastRequestOptionalTLVs.getBroadcastChannelIndicator());
	if(nBroadcastRequestOptionalTLVs.getBroadcastContentTypeInfo())
		_BroadcastContentTypeInfo(
		*nBroadcastRequestOptionalTLVs.getBroadcastContentTypeInfo());
	if(nBroadcastRequestOptionalTLVs.getBroadcastMessageClass())
		_BroadcastMessageClass(
		*nBroadcastRequestOptionalTLVs.getBroadcastMessageClass());
	if(nBroadcastRequestOptionalTLVs.getBroadcastServiceGroup())
		_BroadcastServiceGroup(
		*nBroadcastRequestOptionalTLVs.getBroadcastServiceGroup());
	if(nBroadcastRequestOptionalTLVs.getCallbackNum())
		_CallbackNum(*nBroadcastRequestOptionalTLVs.getCallbackNum());
	if(nBroadcastRequestOptionalTLVs.getCallbackNumAtag())
		_CallbackNumAtag(
		*nBroadcastRequestOptionalTLVs.getCallbackNumAtag());
	if(nBroadcastRequestOptionalTLVs.getCallbackNumPresInd())
		_CallbackNumPresInd(
		*nBroadcastRequestOptionalTLVs.getCallbackNumPresInd());
	if(nBroadcastRequestOptionalTLVs.getDestAddrSubunit())
		_DestAddrSubunit(
		*nBroadcastRequestOptionalTLVs.getDestAddrSubunit());
	if(nBroadcastRequestOptionalTLVs.getDestSubaddress())
		_DestSubaddress(
		*nBroadcastRequestOptionalTLVs.getDestSubaddress());
	if(nBroadcastRequestOptionalTLVs.getDestPort())
		_DestPort(*nBroadcastRequestOptionalTLVs.getDestPort());
	if(nBroadcastRequestOptionalTLVs.getDisplayTime())
		_DisplayTime(*nBroadcastRequestOptionalTLVs.getDisplayTime());
	if(nBroadcastRequestOptionalTLVs.getLanguageIndicator())
		_LanguageIndicator(
		*nBroadcastRequestOptionalTLVs.getLanguageIndicator());
	if(nBroadcastRequestOptionalTLVs.getMessagePayload())
		_MessagePayload(
		*nBroadcastRequestOptionalTLVs.getMessagePayload());
	if(nBroadcastRequestOptionalTLVs.getMsValidity())
		_MsValidity(*nBroadcastRequestOptionalTLVs.getMsValidity());
	if(nBroadcastRequestOptionalTLVs.getPayloadType())
		_PayloadType(*nBroadcastRequestOptionalTLVs.getPayloadType());
	if(nBroadcastRequestOptionalTLVs.getPrivacyIndicator())
		_PrivacyIndicator(
		*nBroadcastRequestOptionalTLVs.getPrivacyIndicator());
	if(nBroadcastRequestOptionalTLVs.getSmsSignal())
		_SmsSignal(*nBroadcastRequestOptionalTLVs.getSmsSignal());
	if(nBroadcastRequestOptionalTLVs.getSourceAddrSubunit())
		_SourceAddrSubunit(
		*nBroadcastRequestOptionalTLVs.getSourceAddrSubunit());
	if(nBroadcastRequestOptionalTLVs.getSourcePort())
		_SourcePort(
		*nBroadcastRequestOptionalTLVs.getSourcePort());
	if(nBroadcastRequestOptionalTLVs.getSourceSubaddress())
		_SourceSubaddress(
		*nBroadcastRequestOptionalTLVs.getSourceSubaddress());
	if(nBroadcastRequestOptionalTLVs.getUserMessageReference())
		_UserMessageReference(
		*nBroadcastRequestOptionalTLVs.getUserMessageReference());
	if(nBroadcastRequestOptionalTLVs.getBroadcastErrorStatus())
		_BroadcastErrorStatus(
		*nBroadcastRequestOptionalTLVs.getBroadcastErrorStatus());
	if(nBroadcastRequestOptionalTLVs.getFailedBroadcastAreaIdentifier())
		_BroadcastAreaIdentifier(
		*nBroadcastRequestOptionalTLVs.getFailedBroadcastAreaIdentifier());
}

void Encoder::_BroadcastResponseOptionalTLVs(
	const BroadcastResponseOptionalTLVs &nBroadcastResponseOptionalTLVs){
	if(nBroadcastResponseOptionalTLVs.getBroadcastErrorStatus())
		_BroadcastErrorStatus(
		*nBroadcastResponseOptionalTLVs.getBroadcastErrorStatus());
	if(nBroadcastResponseOptionalTLVs.getFailedBroadcastAreaIdentifier())
		_BroadcastAreaIdentifier(
		*nBroadcastResponseOptionalTLVs.getFailedBroadcastAreaIdentifier());
}

void Encoder::_MessageDeliveryRequestTLVs(
	const MessageDeliveryRequestTLVs &nMessageDeliveryRequestTLVs){
	if(nMessageDeliveryRequestTLVs.getCallbackNum())
		_CallbackNum(*nMessageDeliveryRequestTLVs.getCallbackNum());
	if(nMessageDeliveryRequestTLVs.getCallbackNumAtag())
		_CallbackNumAtag(
		*nMessageDeliveryRequestTLVs.getCallbackNumAtag());
	if(nMessageDeliveryRequestTLVs.getCallbackNumPresInd())
		_CallbackNumPresInd(
		*nMessageDeliveryRequestTLVs.getCallbackNumPresInd());
	if(nMessageDeliveryRequestTLVs.getDestAddrNpCountry())
		_DestAddrNpCountry(
		*nMessageDeliveryRequestTLVs.getDestAddrNpCountry());
	if(nMessageDeliveryRequestTLVs.getDestAddrNpInformation())
		_DestAddrNpInformation(
		*nMessageDeliveryRequestTLVs.getDestAddrNpInformation());
	if(nMessageDeliveryRequestTLVs.getDestAddrNpResolution())
		_DestAddrNpResolution(
		*nMessageDeliveryRequestTLVs.getDestAddrNpResolution());
	if(nMessageDeliveryRequestTLVs.getDestAddrSubunit())
		_DestAddrSubunit(
		*nMessageDeliveryRequestTLVs.getDestAddrSubunit());
	if(nMessageDeliveryRequestTLVs.getDestNetworkId())
		_DestNetworkId(
		*nMessageDeliveryRequestTLVs.getDestNetworkId());
	if(nMessageDeliveryRequestTLVs.getDestNodeId())
		_DestNodeId(*nMessageDeliveryRequestTLVs.getDestNodeId());
	if(nMessageDeliveryRequestTLVs.getDestSubaddress())
		_DestSubaddress(
		*nMessageDeliveryRequestTLVs.getDestSubaddress());
	if(nMessageDeliveryRequestTLVs.getDestPort())
		_DestPort(*nMessageDeliveryRequestTLVs.getDestPort());
	if(nMessageDeliveryRequestTLVs.getDpfResult())
		_DpfResult(*nMessageDeliveryRequestTLVs.getDpfResult());
	if(nMessageDeliveryRequestTLVs.getItsReplyType())
		_ItsReplyType(*nMessageDeliveryRequestTLVs.getItsReplyType());
	if(nMessageDeliveryRequestTLVs.getItsSessionInfo())
		_ItsSessionInfo(
		*nMessageDeliveryRequestTLVs.getItsSessionInfo());
	if(nMessageDeliveryRequestTLVs.getLanguageIndicator())
		_LanguageIndicator(
		*nMessageDeliveryRequestTLVs.getLanguageIndicator());
	if(nMessageDeliveryRequestTLVs.getMessagePayload())
		_MessagePayload(*nMessageDeliveryRequestTLVs.getMessagePayload());
	if(nMessageDeliveryRequestTLVs.getMessageState())
		_MessageState(*nMessageDeliveryRequestTLVs.getMessageState());
	if(nMessageDeliveryRequestTLVs.getNetworkErrorCode())
		_NetworkErrorCode(
		*nMessageDeliveryRequestTLVs.getNetworkErrorCode());
	if(nMessageDeliveryRequestTLVs.getPayloadType())
		_PayloadType(*nMessageDeliveryRequestTLVs.getPayloadType());
	if(nMessageDeliveryRequestTLVs.getPrivacyIndicator())
		_PrivacyIndicator(
		*nMessageDeliveryRequestTLVs.getPrivacyIndicator());
	if(nMessageDeliveryRequestTLVs.getReceiptedMessageId())
		_ReceiptedMessageId(
		*nMessageDeliveryRequestTLVs.getReceiptedMessageId());
	if(nMessageDeliveryRequestTLVs.getSarMsgRefNum())
		_SarMsgRefNum(*nMessageDeliveryRequestTLVs.getSarMsgRefNum());
	if(nMessageDeliveryRequestTLVs.getSarSegmentSeqnum())
		_SarSegmentSeqnum(
		*nMessageDeliveryRequestTLVs.getSarSegmentSeqnum());
	if(nMessageDeliveryRequestTLVs.getSarTotalSegments())
		_SarTotalSegments(
		*nMessageDeliveryRequestTLVs.getSarTotalSegments());
	if(nMessageDeliveryRequestTLVs.getSourceAddrSubunit())
		_SourceAddrSubunit(
		*nMessageDeliveryRequestTLVs.getSourceAddrSubunit());
	if(nMessageDeliveryRequestTLVs.getSourceNetworkId())
		_SourceNetworkId(
		*nMessageDeliveryRequestTLVs.getSourceNetworkId());
	if(nMessageDeliveryRequestTLVs.getSourceNodeId())
		_SourceNodeId(*nMessageDeliveryRequestTLVs.getSourceNodeId());
	if(nMessageDeliveryRequestTLVs.getSourcePort())
		_SourcePort(*nMessageDeliveryRequestTLVs.getSourcePort());
	if(nMessageDeliveryRequestTLVs.getSourceSubaddress())
		_SourceSubaddress(
		*nMessageDeliveryRequestTLVs.getSourceSubaddress());
	if(nMessageDeliveryRequestTLVs.getUserMessageReference())
		_UserMessageReference(
		*nMessageDeliveryRequestTLVs.getUserMessageReference());
	if(nMessageDeliveryRequestTLVs.getUserResponseCode())
		_UserResponseCode(
		*nMessageDeliveryRequestTLVs.getUserResponseCode());
	if(nMessageDeliveryRequestTLVs.getUssdServiceOp())
		_UssdServiceOp(
		*nMessageDeliveryRequestTLVs.getUssdServiceOp());
}

void Encoder::_MessageDeliveryResponseTLVs(
	const MessageDeliveryResponseTLVs &nMessageDeliveryResponseTLVs){
	if(nMessageDeliveryResponseTLVs.getAdditionalStatusInfoText())
		_AdditionalStatusInfoText(
		*nMessageDeliveryResponseTLVs.getAdditionalStatusInfoText());
	if(nMessageDeliveryResponseTLVs.getDeliveryFailureReason())
		_DeliveryFailureReason(
		*nMessageDeliveryResponseTLVs.getDeliveryFailureReason());
	if(nMessageDeliveryResponseTLVs.getNetworkErrorCode())
		_NetworkErrorCode(
		*nMessageDeliveryResponseTLVs.getNetworkErrorCode());
}

void Encoder::_MessageSubmissionRequestTLVs(
	const MessageSubmissionRequestTLVs &nMessageSubmissionRequestTLVs) {
	if(nMessageSubmissionRequestTLVs.getAlertOnMessageDelivery())
		_AlertOnMessageDelivery(
		*nMessageSubmissionRequestTLVs.getAlertOnMessageDelivery());
	if(nMessageSubmissionRequestTLVs.getBillingIdentification())
		_BillingIdentification(
		*nMessageSubmissionRequestTLVs.getBillingIdentification());
	if(nMessageSubmissionRequestTLVs.getCallbackNum())
		_CallbackNum(*nMessageSubmissionRequestTLVs.getCallbackNum());
	if(nMessageSubmissionRequestTLVs.getCallbackNumAtag())
		_CallbackNumAtag(
		*nMessageSubmissionRequestTLVs.getCallbackNumAtag());
	if(nMessageSubmissionRequestTLVs.getCallbackNumPresInd())
		_CallbackNumPresInd(
		*nMessageSubmissionRequestTLVs.getCallbackNumPresInd());
	if(nMessageSubmissionRequestTLVs.getDestAddrNpCountry())
		_DestAddrNpCountry(
		*nMessageSubmissionRequestTLVs.getDestAddrNpCountry());
	if(nMessageSubmissionRequestTLVs.getDestAddrNpInformation())
		_DestAddrNpInformation(
		*nMessageSubmissionRequestTLVs.getDestAddrNpInformation());
	if(nMessageSubmissionRequestTLVs.getDestAddrNpResolution())
		_DestAddrNpResolution(
		*nMessageSubmissionRequestTLVs.getDestAddrNpResolution());
	if(nMessageSubmissionRequestTLVs.getDestAddrSubunit())
		_DestAddrSubunit(
		*nMessageSubmissionRequestTLVs.getDestAddrSubunit());
	if(nMessageSubmissionRequestTLVs.getDestBearerType())
		_DestBearerType(
		*nMessageSubmissionRequestTLVs.getDestBearerType());
	if(nMessageSubmissionRequestTLVs.getDestNetworkId())
		_DestNetworkId(*nMessageSubmissionRequestTLVs.getDestNetworkId());
	if(nMessageSubmissionRequestTLVs.getDestNetworkType())
		_DestNetworkType(
		*nMessageSubmissionRequestTLVs.getDestNetworkType());
	if(nMessageSubmissionRequestTLVs.getDestNodeId())
		_DestNodeId(*nMessageSubmissionRequestTLVs.getDestNodeId());
	if(nMessageSubmissionRequestTLVs.getDestSubaddress())
		_DestSubaddress(*nMessageSubmissionRequestTLVs.getDestSubaddress());
	if(nMessageSubmissionRequestTLVs.getDestTelematicsId())
		_DestTelematicsId(
		*nMessageSubmissionRequestTLVs.getDestTelematicsId());
	if(nMessageSubmissionRequestTLVs.getDestPort())
		_DestPort(*nMessageSubmissionRequestTLVs.getDestPort());
	if(nMessageSubmissionRequestTLVs.getDisplayTime())
		_DisplayTime(*nMessageSubmissionRequestTLVs.getDisplayTime());
	if(nMessageSubmissionRequestTLVs.getItsReplyType())
		_ItsReplyType(*nMessageSubmissionRequestTLVs.getItsReplyType());
	if(nMessageSubmissionRequestTLVs.getItsSessionInfo())
		_ItsSessionInfo(*nMessageSubmissionRequestTLVs.getItsSessionInfo());
	if(nMessageSubmissionRequestTLVs.getLanguageIndicator())
		_LanguageIndicator(
		*nMessageSubmissionRequestTLVs.getLanguageIndicator());
	if(nMessageSubmissionRequestTLVs.getMessagePayload())
		_MessagePayload(*nMessageSubmissionRequestTLVs.getMessagePayload());
	if(nMessageSubmissionRequestTLVs.getMoreMessagesToSend())
		_MoreMessagesToSend(
		*nMessageSubmissionRequestTLVs.getMoreMessagesToSend());
	if(nMessageSubmissionRequestTLVs.getMsMsgWaitFacilities())
		_MsMsgWaitFacilities(
		*nMessageSubmissionRequestTLVs.getMsMsgWaitFacilities());
	if(nMessageSubmissionRequestTLVs.getMsValidity())
		_MsValidity(*nMessageSubmissionRequestTLVs.getMsValidity());
	if(nMessageSubmissionRequestTLVs.getNumberOfMessages())
		_NumberOfMessages(
		*nMessageSubmissionRequestTLVs.getNumberOfMessages());
	if(nMessageSubmissionRequestTLVs.getPayloadType())
		_PayloadType(*nMessageSubmissionRequestTLVs.getPayloadType());
	if(nMessageSubmissionRequestTLVs.getPrivacyIndicator())
		_PrivacyIndicator(
		*nMessageSubmissionRequestTLVs.getPrivacyIndicator());
	if(nMessageSubmissionRequestTLVs.getQosTimeToLive())
		_QosTimeToLive(*nMessageSubmissionRequestTLVs.getQosTimeToLive());
	if(nMessageSubmissionRequestTLVs.getSarMsgRefNum())
		_SarMsgRefNum(*nMessageSubmissionRequestTLVs.getSarMsgRefNum());
	if(nMessageSubmissionRequestTLVs.getSarSegmentSeqnum())
		_SarSegmentSeqnum(
		*nMessageSubmissionRequestTLVs.getSarSegmentSeqnum());
	if(nMessageSubmissionRequestTLVs.getSarTotalSegments())
		_SarTotalSegments(
		*nMessageSubmissionRequestTLVs.getSarTotalSegments());
	if(nMessageSubmissionRequestTLVs.getSetDpf())
		_SetDpf(*nMessageSubmissionRequestTLVs.getSetDpf());
	if(nMessageSubmissionRequestTLVs.getSmsSignal())
		_SmsSignal(*nMessageSubmissionRequestTLVs.getSmsSignal());
	if(nMessageSubmissionRequestTLVs.getSourceAddrSubunit())
		_SourceAddrSubunit(
		*nMessageSubmissionRequestTLVs.getSourceAddrSubunit());
	if(nMessageSubmissionRequestTLVs.getSourceBearerType())
		_SourceBearerType(
		*nMessageSubmissionRequestTLVs.getSourceBearerType());
	if(nMessageSubmissionRequestTLVs.getSourceNetworkId())
		_SourceNetworkId(
		*nMessageSubmissionRequestTLVs.getSourceNetworkId());
	if(nMessageSubmissionRequestTLVs.getSourceNetworkType())
		_SourceNetworkType(
		*nMessageSubmissionRequestTLVs.getSourceNetworkType());
	if(nMessageSubmissionRequestTLVs.getSourceNodeId())
		_SourceNodeId(*nMessageSubmissionRequestTLVs.getSourceNodeId());
	if(nMessageSubmissionRequestTLVs.getSourcePort())
		_SourcePort(*nMessageSubmissionRequestTLVs.getSourcePort());
	if(nMessageSubmissionRequestTLVs.getSourceSubaddress())
		_SourceSubaddress(
		*nMessageSubmissionRequestTLVs.getSourceSubaddress());
	if(nMessageSubmissionRequestTLVs.getSourceTelematicsId())
		_SourceTelematicsId(
		*nMessageSubmissionRequestTLVs.getSourceTelematicsId());
	if(nMessageSubmissionRequestTLVs.getUserMessageReference())
		_UserMessageReference(
		*nMessageSubmissionRequestTLVs.getUserMessageReference());
	if(nMessageSubmissionRequestTLVs.getUserResponseCode())
		_UserResponseCode(
		*nMessageSubmissionRequestTLVs.getUserResponseCode());
	if(nMessageSubmissionRequestTLVs.getUssdServiceOp())
		_UssdServiceOp(
		*nMessageSubmissionRequestTLVs.getUssdServiceOp());
}

void Encoder::_MessageSubmissionResponseTLVs(
	const MessageSubmissionResponseTLVs &nMessageSubmissionResponseTLVs) {
	if(nMessageSubmissionResponseTLVs.getAdditionalStatusInfoText())
		_AdditionalStatusInfoText(
		*nMessageSubmissionResponseTLVs.getAdditionalStatusInfoText());
	if(nMessageSubmissionResponseTLVs.getDeliveryFailureReason())
		_DeliveryFailureReason(
		*nMessageSubmissionResponseTLVs.getDeliveryFailureReason());
	if(nMessageSubmissionResponseTLVs.getDpfResult())
		_DpfResult(*nMessageSubmissionResponseTLVs.getDpfResult());
	if(nMessageSubmissionResponseTLVs.getNetworkErrorCode())
		_NetworkErrorCode(
		*nMessageSubmissionResponseTLVs.getNetworkErrorCode());
	if(nMessageSubmissionResponseTLVs.getCongestionState())
		_CongestionState(
		*nMessageSubmissionResponseTLVs.getCongestionState());
}

void Encoder::_Bind(const Bind &nBind){
	_Header(nBind);
	_CoctetString(nBind.getSystemId());
	_CoctetString(nBind.getPassword());
	_CoctetString(nBind.getSystemType());
	_quint8(nBind.getInterfaceVersion());
	_quint8(nBind.getAddrTON());
	_quint8(nBind.getAddrNPI());
	_CoctetString(nBind.getAddressRange());
}

void Encoder::_BindResp(const BindResp &nBindResp){
	_Header(nBindResp);
	_CoctetString(nBindResp.getSystemId());
	if(nBindResp.getSrInterfaceVersion())
		_SrInterfaceVersion(*nBindResp.getSrInterfaceVersion());
}

void Encoder::_Outbind(const Outbind &nOutbind){
	_Header(nOutbind);
	_CoctetString(nOutbind.getSystemId());
	_CoctetString(nOutbind.getPassword());
}

void Encoder::_Unbind(const Unbind &nUnbind){
	_Header(nUnbind);
}

void Encoder::_UnbindResp(const UnbindResp &nUnbindResp){
	_Header(nUnbindResp);
}

void Encoder::_EnquireLink(const EnquireLink &nEnquireLink){
	_Header(nEnquireLink);
}

void Encoder::_EnquireLinkResp(const EnquireLinkResp &nEnquireLinkResp){
	_Header(nEnquireLinkResp);
}

void Encoder::_AlertNotification(
	const AlertNotification &nAlertNotification){
	_Header(nAlertNotification);
	_quint8(nAlertNotification.getSourceAddrTON());
	_quint8(nAlertNotification.getSourceAddrNPI());
	_CoctetString(nAlertNotification.getSourceAddr());
	_quint8(nAlertNotification.getESMEAddrTON());
	_quint8(nAlertNotification.getESMEAddrNPI());
	_CoctetString(nAlertNotification.getESMEAddr());
	if(nAlertNotification.getMsAvailabilityStatus())
		_MsAvailabilityStatus(
		*nAlertNotification.getMsAvailabilityStatus());
}

void Encoder::_GenericNack(const GenericNack &nGenericNack){
	_Header(nGenericNack);
}

void Encoder::_SubmitSM(
	const SubmitSM &nSubmitSM){
	_Header(nSubmitSM);
	_CoctetString(nSubmitSM.getServiceType());
	_quint8(nSubmitSM.getSourceAddrTON());
	_quint8(nSubmitSM.getSourceAddrNPI());
	_CoctetString(nSubmitSM.getSourceAddr());
	_quint8(nSubmitSM.getDestAddrTON());
	_quint8(nSubmitSM.getDestAddrNPI());
	_CoctetString(nSubmitSM.getDestAddr());
	_quint8(nSubmitSM.getEsmClass());
	_quint8(nSubmitSM.getProtocolId());
	_quint8(nSubmitSM.getPriorityFlag());
	_CoctetString(nSubmitSM.getScheduleDeliveryTime());
	_CoctetString(nSubmitSM.getValidityPeriod());
	_quint8(nSubmitSM.getRegisteredDelivery());
	_quint8(nSubmitSM.getReplaceIfPresentFlag());
	_quint8(nSubmitSM.getDataCoding());
	_quint8(nSubmitSM.getSMDefaultMsgId());
	_quint8(nSubmitSM.getSMLength());
	_octetString(nSubmitSM.getShortMessage());
	_MessageSubmissionRequestTLVs(nSubmitSM);
}

void Encoder::_SubmitSMResp(
	const SubmitSMResp &nSubmitSMResp){
	_Header(nSubmitSMResp);
	_CoctetString(nSubmitSMResp.getMessageId());
	_MessageSubmissionResponseTLVs(nSubmitSMResp);
}

void Encoder::_DataSM(
	const DataSM &nDataSM){
	_Header(nDataSM);
	_CoctetString(nDataSM.getServiceType());
	_quint8(nDataSM.getSourceAddrTON());
	_quint8(nDataSM.getSourceAddrNPI());
	_CoctetString(nDataSM.getSourceAddr());
	_quint8(nDataSM.getDestAddrTON());
	_quint8(nDataSM.getDestAddrNPI());
	_CoctetString(nDataSM.getDestAddr());
	_quint8(nDataSM.getEsmClass());
	_quint8(nDataSM.getRegisteredDelivery());
	_quint8(nDataSM.getDataCoding());
	_MessageSubmissionRequestTLVs(nDataSM);
}

void Encoder::_DataSMResp(
	const DataSMResp &nDataSMResp){
	_Header(nDataSMResp);
	_CoctetString(nDataSMResp.getMessageId());
	_MessageSubmissionResponseTLVs(nDataSMResp);
}

void Encoder::_SubmitMulti(
	const SubmitMulti &nSubmitMulti){
	_Header(nSubmitMulti);
	_CoctetString(nSubmitMulti.getServiceType());
	_quint8(nSubmitMulti.getSourceAddrTON());
	_quint8(nSubmitMulti.getSourceAddrNPI());
	_CoctetString(nSubmitMulti.getSourceAddr());
	_quint8(nSubmitMulti.getNumberOfDest());
	QVector<DestAddress> nDestAddresses(nSubmitMulti.getDestAddress());
	for(int i=0;i<nDestAddresses.size();i++){
		DestAddress nDestAddress(nDestAddresses[i]);
		quint8 nDestFlag(nDestAddress.getDestFlag());
		_quint8(nDestFlag);
		if(nDestFlag==0x01){
			_quint8(nDestAddress.getTON());
			_quint8(nDestAddress.getNPI());
		}
		_CoctetString(nDestAddress.getAddressOrDistrListName());
	}
	_quint8(nSubmitMulti.getEsmClass());
	_quint8(nSubmitMulti.getProtocolId());
	_quint8(nSubmitMulti.getPriorityFlag());
	_CoctetString(nSubmitMulti.getScheduleDeliveryTime());
	_CoctetString(nSubmitMulti.getValidityPeriod());
	_quint8(nSubmitMulti.getRegisteredDelivery());
	_quint8(nSubmitMulti.getReplaceIfPresentFlag());
	_quint8(nSubmitMulti.getDataCoding());
	_quint8(nSubmitMulti.getSMDefaultMsgId());
	_quint8(nSubmitMulti.getSMLength());
	_octetString(nSubmitMulti.getShortMessage());
	_MessageSubmissionRequestTLVs(nSubmitMulti);
}

void Encoder::_SubmitMultiResp(
	const SubmitMultiResp &nSubmitMultiResp){
	_Header(nSubmitMultiResp);
	_CoctetString(nSubmitMultiResp.getMessageId());
	_quint8(nSubmitMultiResp.getNoUnsuccess());
	QVector<UnsuccessSME> nUnsuccessSMEs(nSubmitMultiResp.getUnsuccessSME());
	for(int i=0;i<nUnsuccessSMEs.size();i++){
		UnsuccessSME nUnsuccessSME(nUnsuccessSMEs[i]);
		_quint8(nUnsuccessSME.getDestAddrTON());
		_quint8(nUnsuccessSME.getDestAddrNPI());
		_CoctetString(nUnsuccessSME.getDestinationAddr());
		_quint32(nUnsuccessSME.getErrorStatusCode());
	}
	_MessageSubmissionResponseTLVs(nSubmitMultiResp);
}

void Encoder::_DeliverSM(
	const DeliverSM &nDeliverSM){
	_Header(nDeliverSM);
	_CoctetString(nDeliverSM.getServiceType());
	_quint8(nDeliverSM.getSourceAddrTON());
	_quint8(nDeliverSM.getSourceAddrNPI());
	_CoctetString(nDeliverSM.getSourceAddr());
	_quint8(nDeliverSM.getDestAddrTON());
	_quint8(nDeliverSM.getDestAddrNPI());
	_CoctetString(nDeliverSM.getDestAddr());
	_quint8(nDeliverSM.getEsmClass());
	_quint8(nDeliverSM.getProtocolId());
	_quint8(nDeliverSM.getPriorityFlag());
	_CoctetString(nDeliverSM.getScheduleDeliveryTime());
	_CoctetString(nDeliverSM.getValidityPeriod());
	_quint8(nDeliverSM.getRegisteredDelivery());
	_quint8(nDeliverSM.getReplaceIfPresentFlag());
	_quint8(nDeliverSM.getDataCoding());
	_quint8(nDeliverSM.getSMDefaultMsgId());
	_quint8(nDeliverSM.getSMLength());
	_octetString(nDeliverSM.getShortMessage());
	_MessageDeliveryRequestTLVs(nDeliverSM);
}

void Encoder::_DeliverSMResp(
	const DeliverSMResp &nDeliverSMResp){
	_Header(nDeliverSMResp);
	_CoctetString(nDeliverSMResp.getMessageId());
	_MessageDeliveryResponseTLVs(nDeliverSMResp);
}

void Encoder::_BroadcastSM(
	const BroadcastSM &nBroadcastSM){
	_Header(nBroadcastSM);
	_CoctetString(nBroadcastSM.getServiceType());
	_quint8(nBroadcastSM.getSourceAddrTON());
	_quint8(nBroadcastSM.getSourceAddrNPI());
	_CoctetString(nBroadcastSM.getSourceAddr());
	_CoctetString(nBroadcastSM.getMessageId());
	_quint8(nBroadcastSM.getPriorityFlag());
	_CoctetString(nBroadcastSM.getScheduleDeliveryTime());
	_CoctetString(nBroadcastSM.getValidityPeriod());
	_quint8(nBroadcastSM.getReplaceIfPresentFlag());
	_quint8(nBroadcastSM.getDataCoding());
	_quint8(nBroadcastSM.getSMDefaultMsgId());
	if(nBroadcastSM.getBroadcastAreaIdentifier())
		_BroadcastAreaIdentifier(
		*nBroadcastSM.getBroadcastAreaIdentifier());
	if(nBroadcastSM.getBroadcastContentType())
		_BroadcastContentType(
		*nBroadcastSM.getBroadcastContentType());
	if(nBroadcastSM.getBroadcastRepNum())
		_BroadcastRepNum(
		*nBroadcastSM.getBroadcastRepNum());
	if(nBroadcastSM.getBroadcastFrequencyInterval())
		_BroadcastFrequencyInterval(
		*nBroadcastSM.getBroadcastFrequencyInterval());
	_BroadcastRequestOptionalTLVs(nBroadcastSM);
}

void Encoder::_BroadcastSMResp(
	const BroadcastSMResp &nBroadcastSMResp){
	_Header(nBroadcastSMResp);
	_CoctetString(nBroadcastSMResp.getMessageId());
	_BroadcastResponseOptionalTLVs(nBroadcastSMResp);
}

void Encoder::_CancelSM(
	const CancelSM &nCancelSM){
	_Header(nCancelSM);
	_CoctetString(nCancelSM.getServiceType());
	_CoctetString(nCancelSM.getMessageId());
	_quint8(nCancelSM.getSourceAddrTON());
	_quint8(nCancelSM.getSourceAddrNPI());
	_CoctetString(nCancelSM.getSourceAddr());
	_quint8(nCancelSM.getDestAddrTON());
	_quint8(nCancelSM.getDestAddrNPI());
	_CoctetString(nCancelSM.getDestAddr());
}

void Encoder::_CancelSMResp(
	const CancelSMResp &nCancelSMResp){
	_Header(nCancelSMResp);
}

void Encoder::_QuerySM(
	const QuerySM &nQuerySM){
	_Header(nQuerySM);
	_CoctetString(nQuerySM.getMessageId());
	_quint8(nQuerySM.getSourceAddrTON());
	_quint8(nQuerySM.getSourceAddrNPI());
	_CoctetString(nQuerySM.getSourceAddr());
}

void Encoder::_QuerySMResp(
	const QuerySMResp &nQuerySMResp){
	_Header(nQuerySMResp);
	_CoctetString(nQuerySMResp.getMessageId());
	_CoctetString(nQuerySMResp.getFinalDate());
	_quint8(nQuerySMResp.getMessageState());
	_quint8(nQuerySMResp.getErrorCode());
}

void Encoder::_ReplaceSM(
	const ReplaceSM &nReplaceSM){
	_Header(nReplaceSM);
	_CoctetString(nReplaceSM.getMessageId());
	_quint8(nReplaceSM.getSourceAddrTON());
	_quint8(nReplaceSM.getSourceAddrNPI());
	_CoctetString(nReplaceSM.getSourceAddr());
	_CoctetString(nReplaceSM.getScheduleDeliveryTime());
	_CoctetString(nReplaceSM.getValidityPeriod());
	_quint8(nReplaceSM.getRegisteredDelivery());
	_quint8(nReplaceSM.getSMDefaultMsgId());
	_quint8(nReplaceSM.getSMLength());
	_octetString(nReplaceSM.getShortMessage());
	_MessageReplacementTLVs(nReplaceSM);
}

void Encoder::_ReplaceSMResp(
	const ReplaceSMResp &nReplaceSMResp){
	_Header(nReplaceSMResp);
}

void Encoder::_QueryBroadcastSM(
	const QueryBroadcastSM &nQueryBroadcastSM){
	_Header(nQueryBroadcastSM);
	_CoctetString(nQueryBroadcastSM.getMessageId());
	_quint8(nQueryBroadcastSM.getSourceAddrTON());
	_quint8(nQueryBroadcastSM.getSourceAddrNPI());
	_CoctetString(nQueryBroadcastSM.getSourceAddr());
	_QueryBroadcastRequestOptionalTLVs(nQueryBroadcastSM);
}

void Encoder::_QueryBroadcastSMResp(
	const QueryBroadcastSMResp &nQueryBroadcastSMResp){
	_Header(nQueryBroadcastSMResp);
	if(nQueryBroadcastSMResp.getMessageState())
		_MessageState(*nQueryBroadcastSMResp.getMessageState());
	for(int i=0;
		i<nQueryBroadcastSMResp.getBroadcastAreaIdentifier().size();i++)
		_BroadcastAreaIdentifier(
		nQueryBroadcastSMResp.getBroadcastAreaIdentifier()[i]);
	if(nQueryBroadcastSMResp.getBroadcastAreaSuccess())
		_BroadcastAreaSuccess(
		*nQueryBroadcastSMResp.getBroadcastAreaSuccess());
}

void Encoder::_CancelBroadcastSM(
	const CancelBroadcastSM &nCancelBroadcastSM){
	_Header(nCancelBroadcastSM);
	_CoctetString(nCancelBroadcastSM.getServiceType());
	_CoctetString(nCancelBroadcastSM.getMessageId());
	_quint8(nCancelBroadcastSM.getSourceAddrTON());
	_quint8(nCancelBroadcastSM.getSourceAddrNPI());
	_CoctetString(nCancelBroadcastSM.getSourceAddr());
	_CancelBroadcastOptionalTLVs(nCancelBroadcastSM);
}

void Encoder::_CancelBroadcastSMResp(
	const CancelBroadcastSMResp &nCancelBroadcastSMResp){
	_Header(nCancelBroadcastSMResp);
}
